home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / enscript.4 / enscript / enscript-1.4.0 / src / testcase.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1996-06-29  |  4.6 KB  |  220 lines

  1. #!/bin/sh
  2. # Testcase for enscript.
  3. # Copyright (c) 1996 Markku Rossi.
  4. # Author: Markku Rossi <mtr@iki.fi>
  5. #
  6.  
  7. #
  8. # This file is part of GNU enscript.
  9. # This program is free software; you can redistribute it and/or modify
  10. # it under the terms of the GNU General Public License as published by
  11. # the Free Software Foundation; either version 2, or (at your option)
  12. # any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. # GNU General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU General Public License
  20. # along with this program; see the file COPYING.  If not, write to
  21. # the Free Software Foundation, 59 Temple Place - Suite 330,
  22. # Boston, MA 02111-1307, USA.
  23. #
  24.  
  25. srcdir=$1
  26.  
  27. if test "X$srcdir" = "X"; then
  28.   echo "Usage: $0 srcdir"
  29.   exit 1
  30. fi
  31.  
  32. ENSCRIPT_LIBRARY="$srcdir/../lib"
  33. export ENSCRIPT_LIBRARY
  34.  
  35. tstfile=enscript-test-output.ps
  36.  
  37. echo Testing enscript...
  38.  
  39. if test -f $tstfile; then
  40.   rm $tstfile
  41. fi
  42.  
  43. files="$srcdir/main.c $srcdir/gsint.h enscript"
  44.  
  45.  
  46. echo "* printing some files"
  47. ./enscript --quiet -G2r -p$tstfile $files
  48. rm $tstfile
  49.  
  50.  
  51. echo "* printing some files with Times-Roman7 font"
  52. ./enscript --quiet -G2r -p$tstfile -fTimes-Roman7 $files
  53. rm $tstfile
  54.  
  55.  
  56. echo "* options:"
  57.  
  58. srcfile="$srcdir/main.c"
  59.  
  60. echo "  --columns"
  61. ./enscript --quiet --columns=5 -p$tstfile $srcfile
  62.  
  63. echo "  --pages"
  64. ./enscript --quiet --pages=2-3 -p$tstfile $srcfile
  65. ./enscript --quiet --pages=-3 -p$tstfile $srcfile
  66. ./enscript --quiet --pages=2- -p$tstfile $srcfile
  67. ./enscript --quiet --pages=odd -p$tstfile $srcfile
  68. ./enscript --quiet --pages=even -p$tstfile $srcfile
  69.  
  70. echo "  --line-numbers"
  71. ./enscript --quiet --line-numbers -p$tstfile $srcfile
  72.  
  73. echo "  --highlight-bars"
  74. ./enscript --quiet --highlight-bars -p$tstfile $srcfile
  75.  
  76. echo "  --indent"
  77. ./enscript --quiet --indent=5 -p$tstfile $srcfile
  78.  
  79. echo "  --filter"
  80. ./enscript --quiet --filter="cat %s" -p$tstfile $srcfile
  81.  
  82. echo "  --borders"
  83. ./enscript --quiet --borders -p$tstfile $srcfile
  84.  
  85. echo "  --underlay"
  86. ./enscript --quiet --underlay="Hello, world!" -p$tstfile $srcfile
  87.  
  88.  
  89. echo "* special escapes"
  90.  
  91. links="README.ESCAPES mtr.eps mtr_small.eps mtr_tiny.eps"
  92.  
  93. for i in $links; do
  94.   ln -s $srcdir/../$i .
  95. done
  96.  
  97. ./enscript --quiet -G2r -p$tstfile -e README.ESCAPES
  98.  
  99. for i in $links; do
  100.   rm -f $i
  101. done
  102.  
  103.  
  104. echo "* fancy headers:"
  105.  
  106. for i in a2ps edd emacs enscript frame mp; do
  107.   echo "  $i"
  108.   ./enscript -2r --quiet --fancy=$i -p$tstfile $srcdir/main.c
  109. done
  110.  
  111.  
  112. echo "* media:"
  113.  
  114. for i in A3 A4 A5 Letter Legal A4dj Letterdj; do
  115.   echo "  $i"
  116.   ./enscript -G2r --quiet --media=$i -p$tstfile $srcdir/../README
  117. done
  118.  
  119.  
  120. echo "* encodings:"
  121.  
  122. for i in ascii asciiscands ibmpc latin1 latin2 latin3 mac vms hp8; do
  123.   echo "  $i"
  124.   ./enscript -G2r --quiet --encoding=$i -p$tstfile $srcdir/../$i.txt
  125. done
  126.  
  127.  
  128. echo "* pass through files:"
  129.  
  130. echo "  PostScript"
  131.  
  132. cat >test_input.ps <<EOF
  133. %!
  134. /Times-Roman findfont 30 scalefont setfont
  135. 100 100 moveto (Hi, I am a PostScript file) show
  136. showpage
  137. EOF
  138.  
  139. ### test_pass_through() {
  140. ./enscript -G2r --quiet --pass-through -p- test_input.ps \
  141.   | tail +2 >$tstfile
  142.  
  143. result=`tail +2 test_input.ps | cmp - $tstfile`
  144.  
  145. if test "X$result" != "X"; then
  146.   echo "FAIL: files differ: $result"
  147. fi
  148.  
  149. rm test_input.ps
  150. ### }
  151.  
  152. echo "  Windows PostScript"
  153.  
  154. echo 'D%!' | tr 'D' '\4' >test_input.ps
  155. cat >>test_input.ps <<EOF
  156. /Times-Roman findfont 30 scalefont setfont
  157. 100 100 moveto (Hi, I am a Windows damaged PostScript file) show
  158. showpage
  159. EOF
  160.  
  161. ### test_pass_through() {
  162. ./enscript -G2r --quiet --pass-through -p- test_input.ps \
  163.   | tail +2 >$tstfile
  164.  
  165. result=`tail +2 test_input.ps | cmp - $tstfile`
  166.  
  167. if test "X$result" != "X"; then
  168.   echo "FAIL: files differ: $result"
  169. fi
  170.  
  171. rm test_input.ps
  172. ### }
  173.  
  174. echo "  PCL"
  175.  
  176. echo '@E' | tr '@' '\33' >test_input.pcl
  177. cat >>test_input.pcl <<EOF
  178. This isn't really a PCL file but the magic is correct.
  179. EOF
  180.  
  181. ### test_pass_through() {
  182. ./enscript -G2r --quiet --pass-through -p- test_input.pcl \
  183.   | tail +2 >$tstfile
  184.  
  185. result=`tail +2 test_input.pcl | cmp - $tstfile`
  186.  
  187. if test "X$result" != "X"; then
  188.   echo "FAIL: files differ: $result"
  189. fi
  190.  
  191. rm test_input.pcl
  192. ### }
  193.  
  194. echo "  PCL 2"
  195.  
  196. echo '@%' | tr '@' '\33' >test_input.pcl
  197. cat >>test_input.pcl <<EOF
  198. This isn't really a PCL file but the magic is correct.
  199. EOF
  200.  
  201. ### test_pass_through() {
  202. ./enscript -G2r --quiet --pass-through -p- test_input.pcl \
  203.   | tail +2 >$tstfile
  204.  
  205. result=`tail +2 test_input.pcl | cmp - $tstfile`
  206.  
  207. if test "X$result" != "X"; then
  208.   echo "FAIL: files differ: $result"
  209. fi
  210.  
  211. rm test_input.pcl
  212. ### }
  213.  
  214.  
  215. # End of tests.
  216.  
  217. rm $tstfile
  218.